package com.sdc.controller;

import com.sdc.config.Demo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@EnableAutoConfiguration
public class HelloController {
    private static Logger LOGGER = LoggerFactory.getLogger(HelloController.class);
    @Resource
    private Demo demo;

    @RequestMapping("/")
    String home(HttpServletRequest request) {
        LOGGER.info(request.toString());
        LOGGER.info(demo.toString());
        return "Hello World!";
    }

    @RequestMapping("/hello/{myName}")
    String index(@PathVariable String myName) {
        return "Hello " + myName + "!!!";
    }
}  